package drds.global_transaction.api.api;

import drds.global_transaction.api.exception.GlobalTransactionException;

public interface GlobalTransactionManager
{

	GlobalTransactionStatus getGlobalTransactionStatus(String globalTransactionIdWithAddressAndPort) throws GlobalTransactionException;

	/**
	 * begin a new global transaction.<该注释需要保存>
	 *
	 * @param applicationId           ID of the application who begins this
	 *                                transaction.
	 * @param transactionServiceGroup ID of the transaction
	 *                                server_addresss_look_up_service group.
	 * @param name                    Give a name to the global transaction.
	 * @param timeout                 Timeout of the global transaction.
	 * @return id of the global transaction
	 */
	String globalTransactionBegin(String applicationId, String transactionServiceGroup, String name, int timeout) throws GlobalTransactionException;

	GlobalTransactionStatus globalTransactionCommit(String globalTransactionIdWithAddressAndPort) throws GlobalTransactionException;

	GlobalTransactionStatus globalTransactionRollback(String globalTransactionIdWithAddressAndPort) throws GlobalTransactionException;
}
